package com.example.mallsystem1104.controller;

import com.example.mallsystem1104.common.Result;
import com.example.mallsystem1104.service.IncomeService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author zy
 * @Date 2024/12/13 17:36
 * @packageName:com.example.mallsystem1104.controller
 * @ClassName:IncomeService
 */
@RestController
@RequestMapping("/api/income")
@CrossOrigin
public class IncomeController {
    @Resource
    private IncomeService incomeService;

    @GetMapping("/chart")
    public Result getChart(){
        return Result.success(incomeService.getChart());
    }

    @GetMapping("/week")
    public Result getWeekIncome(){
        return Result.success(incomeService.getWeekIncome());
    }

    @GetMapping("/month")
    public Result getMonthIncome(){
        return Result.success(incomeService.getMonthIncome());
    }
}
